<template>
  <div>
    <!--  顶部栏  -->
    <div class="header">
      <div class="right">
        <img class="avatar" src="../assets/avater.png">
        <div class="name">
          {{adminName}}
        </div>
        <div class="adminType">{{ adminType }}</div>
        <img class="exist" src="../assets/exist.png" @click="exit()">
      </div>
    </div>

    <!--  侧边栏  -->
    <div class="left-tab">
      <div class="tab-header">
        <img src="../assets/logo.png">
        <h1>AI辅助创作</h1>
      </div>
      <div class="tab-list">
        <router-link
            class="tab-item"
            active-class="tab-item active"
            to="/pc/index">
          <i class="el-icon-s-data" ></i>
          <div class="title ">首页</div>
        </router-link>
        <router-link
            class="tab-item"
            active-class="tab-item active"
            to="/pc/aicreation">
          <i class="el-icon-user-solid" ></i>
          <div class="title ">智能AI</div>
        </router-link>
        <router-link
            class="tab-item"
            active-class="tab-item active"
            to="/pc/mine">
          <i class="el-icon-user-solid" ></i>
          <div class="title ">我的</div>
        </router-link>
<!--        <a
            class="tab-item"
            href="https://l4rzgygpx7.k.topthink.com/@asnull/yidongduan.html"
            target="_blank">
          <i class="el-icon-s-opportunity" ></i>
          <div class="title ">使用手册</div>
        </a>-->

      </div>
    </div>

    <!--  主体内容  -->

    <div class="main">
      <div class="block"><!--  占位块勿删    --></div>
      <!--   内容框架   -->
      <div class="main-content">
        <router-view></router-view>
      </div>


    </div>
  </div>
</template>

<script>


export default {
  name: 'waterworks-home',
  components: {},
  data(){
    return{
    }
  },
  computed: {
    adminName(){
      return JSON.parse(localStorage.getItem('userInfo')).name;
    },
    adminType(){
      let user = JSON.parse(localStorage.getItem('userInfo')).name;
      return user === '测试账号1'?'测试账号':'普通用户'
    }
  },
  methods:{
    // exit login
    exit(){
      this.$confirm('确定退出登录吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        localStorage.removeItem('userInfo')
        location.reload()
        this.$message({
          message: `退出登录成功~`,
          type: 'success'
        });
      }).catch(() => {
      });

    }
  },
  mounted() {
    let name = JSON.parse(localStorage.getItem('userInfo')).name;
    this.$message({
      message: `您好啊${name}，欢迎回来~`,
      type: 'success'
    });
  }
}
</script>
<style scoped lang="less" >

  /* 顶部栏*/
  .header{
    z-index: 999;
    width: 100%;
    position: fixed;
    top: 0;
    display: flex;
    justify-content: flex-end;
    height: 64px;
    background-color: #fff;
    padding: 0 30px;
    border-bottom: solid 1px rgba(231, 231, 231, 1);
    .right{
      display: flex;
      height: 64px;
      align-items: center;
      .avatar{
        height: 35px;
        width: 35px;
      }
      .name{
        font-size: 16px;
        color: rgba(0, 0, 0, 1);
        margin-left: 10px;
      }
      .adminType{
        border-radius: 2px;
        background-color: rgba(0, 82, 217, 0.08);
        font-size: 14px;
        color: rgba(0, 82, 217, 1);
        padding: 4px 6px;
        margin-left: 10px;
      }
      .exist{
        height: 35px;
        width: 35px;
        padding: 8px;
        cursor: pointer;
        margin-left: 30px;
      }
    }
  }

  /*侧边栏*/
  .left-tab{
    position: fixed;
    top: 0;
    width: 168px;
    left: 0;
    z-index: 999;
    height: 100vh;
    background-color: #fff;
    .tab-header{
      width: 176px;
      height: 64px;
      display: flex;
      align-items: center;
      padding-left: 20px;
      border-bottom: solid 1px rgba(231, 231, 231, 1);
      img{
        height: 35px;
        width: 35px;
      }
      h1{
        font-size: 18px;
        margin-left: 10px;
      }
    }
    .tab-list{
      margin: 15px 10px;
      .tab-item{
        display: flex;
        height: 45px;
        justify-content: center;
        align-items: center;
        //background-color: #2468F2;
        border-radius: 5px;
        margin-bottom: 10px;
        transition: all .2s;
        i{
          font-size: 25px;
          color: rgba(233, 232, 237, 1);
        }
        .title{
          font-size: 14px;
          color: rgba(0, 0, 0, 0.6);
          margin-left: 12px;
        }
        &:hover{
          background-color: rgba(83, 86, 90, 0.05);
        }
      }
      .active{
        background-color: rgba(83, 86, 90, 0.05);
        i{
          color: rgba(57, 145, 238, 1);
        }
        .title{
          color: rgba(57, 145, 238, 1);
        }
      }
    }

  }

  /*主体*/
  .main{
    display: flex;
    width: 100%;
    //padding-top: 64px;
    .block{
      width: 168px;
      height: 100vh;
    }
    .main-content{
      overflow: hidden;
      flex: 1;
      margin: 79px 15px 15px 15px;
      background-color: #fff;
    }
  }
</style>
